import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * java 8中会进入死循环
 */
public class TestConMap {

    private Map cache = new ConcurrentHashMap<Integer, Integer>(15);

    public static void main(String[] args) {
        TestConMap conMap = new TestConMap();
        System.out.println(conMap.fibo(80));
    }

    public Integer fibo(Integer i) {
        if (i == 1 || i == 0) {
            return i;
        }
        return (Integer) cache.computeIfAbsent(i, (key) -> {
            System.out.println("fibo:" + key);
            return fibo((Integer) key - 1) + fibo((Integer) key - 2);
        });
    }

    ;
}
